import { eLocalStorageConfig } from '@/interface/elocal_storage';
import { AsyncRoute } from '@/router/main';
import { getSessionStorage } from '@/utils/utils';
import { defineStore } from 'pinia';
import { RouteRecordRaw } from 'vue-router';

const getAsyncRoute = (function () {
    // TODO 待路由权限修改
    return sessionStorage.getItem(eLocalStorageConfig.LOG_LEVEL) === 'admin' ? AsyncRoute : getSessionStorage(eLocalStorageConfig.ROUTES, []);
    // return AsyncRoute;
})();

export const useMenus = defineStore('menus', {
    state: () => {
        return <{ asyncRoutes: RouteRecordRaw[], all_routes: RouteRecordRaw[], }>{
            asyncRoutes: getAsyncRoute,
            
        };
    },
    actions: {},
});
